﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IOTest
{
    class Program
    {
        static void Main(string[] args)
        {
            //创建mysolo文件夹
            DirectoryInfo info = new DirectoryInfo("D:\\mysolo");
            info.Create();
            Console.WriteLine("父文件夹mysolo：" + info.Parent.FullName);
            //创建文件
            FileInfo file = new FileInfo("D:\\mysolo\\test.txt");
            Console.WriteLine("文档创建时间：" + file.CreationTime);
            Console.WriteLine("文档路径：" + file.DirectoryName);
            //创建子目录
            info.CreateSubdirectory("dir1");//这里直接写文件夹名字就可以了，不用路径，因为info对象已经说明了在D:\\mysolo下面
            //写文件
            string path = "D:\\mysolo\\test.txt";
            StreamWriter streamWriter = new StreamWriter(path);
            streamWriter.WriteLine("曾婷");
            streamWriter.WriteLine(3);
            streamWriter.Flush();
            streamWriter.Close();

        }
    }
}
